import requests

# 测试用授权码
amapKey = '8e8baa8a7317586c29ec694895de6e0a'

url = f"https://restapi.amap.com/v3/ip?key={amapKey}"
response = requests.get(url)
print(response.json()['adcode'])

weather_url = f"https://restapi.amap.com/v3/weather/weatherInfo?key={amapKey}&extensions=base&city={response.json()['adcode']}"
weather_response = requests.get(weather_url)
print(weather_response.json())
